<?php $self = 'self' . time() . rand(1, 10000); ?>
<style type="text/css">
    #ajaxAddTaskOperateForm .form-body .form-group {
        width: 50%;
        float: left;
    }

    #ajaxAddTaskOperateForm .form-body .form-group .col-xs-3 {
        width: 45%;
    }

    #ajaxAddTaskOperateForm .form-body .form-group .col-xs-4 {
        width: 45%;
    }

    .ECalendarBox {
        z-index: 100;
    }

    .ECalendarBox .currentdate h2 {
        margin-top: 0px;
    }

    .modal-dialog {
        width: 1280px;
    }

    td {
        text-align: center;
    }

    tr{
        line-height: 35px;
    }
    .modal_image_list .form-group {
        float: left;
        margin-top: 30px;
    }

    .modal_image_list img {
        float: left;
        margin-left: 30px;
    }
</style>
<link href="<?= image_url('/static/assets/global/css/ecalendar-style.css') ?>" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="<?= image_url('/static/js/Ecalendar.jquery.min.js') ?>"></script>
<?= form_open('', Array('class' => 'form-horizontal', 'role' => 'form', 'id' => 'ajaxViewOperateDetail', 'data-category-id' => $obj->id, 'name' => 'ajaxViewOperateDetail', 'onsubmit' => 'return submitForm()')) ?>
<div class="portlet-body form " id="<?php echo $self; ?>">
    <input type="hidden" id="update_time" name="update_time"
           value="<?= set_value('update_time', $user->update_time) ?>"/>
    <div class="form-body">
        <div class="table-scrollable">
            <table class="table table-hover table-bordered table-striped">
                <tr>
                    <td align="right" width="10%">付款类型：</td>
                    <td class="bold" width="15%"><?= IOSS_StaticConfig::$payTypeArray[$obj->payment_type] ?></td>
                    <td align="right" width="10%">款项ID：</td>
                    <td class="bold" width="15%"><?= $obj->id ?></td>
                    <td align="right" width="10%">所属记录ID：</td>
                    <td class="bold" width="15%"><?= $record->id ?> - <a href="javascript:ioss_url_modal('<?= site_url('/tasks/taskrecords/ajaxViewDetail/' . $record->id) ?>');" class="btn btn-sm blue"><i class="fa fa-play"></i> 查看</a></td>
                    <td align="right" width="10%">所属任务ID：</td>
                    <td class="bold" width="15%"><?= $task->id ?> - <a href="<?= site_url('/tasks/task/view/' . $task->id) ?>" target="_blank" class="btn btn-sm red"><i class="fa fa-play"></i> 查看</a></td>
                </tr>
                <tr>
                    <td align="right" width="10%">接单者：</td>
                    <td class="bold" width="15%"><?= $allReviewsAdmin[$record->operator_id] ?></td>
                    <td align="right" width="10%">关联财务申请：</td>
                    <td class="bold" width="15%"><?php if($obj->pay_request_id):?><?= $obj->pay_request_id ?> - <a href="<?= site_url('/finance/apply/detail/' . $obj->pay_request_id) ?>" target="_blank" class="btn btn-sm green">查看</a><?php else:?><span style="color:#e20000;">未提交申请</span><?php endif;?></td>
                    <td align="right" width="10%">关联财务操作人：</td>
                    <td class="bold" width="15%"><?= $allFanaceAdmin[$obj->finace_id] ?></td>
                    <td align="right" width="10%">打款方式：</td>
                    <td class="bold"><?= IOSS_StaticConfig::getPayMethod($obj->pay_method)?IOSS_StaticConfig::getPayMethod($obj->pay_method): '未填'?></td>
                </tr>
                <tr>
                    <td align="right">购买商品时价格：</td>
                    <td class="bold"><?= $record->true_product_price > 0 ? number_format($record->true_product_price, 3, '.', '') : '' ?> <?= IOSS_StaticConfig::getcoinTypeInfo($record->buyer_pay_coin_type) ?></td>
                    <td align="right">买家付款金额：</td>
                    <td class="bold text-center"><?= $record->buyer_pay_total > 0 ? number_format($record->buyer_pay_total, 3, '.', '') : '' ?> <?= IOSS_StaticConfig::getcoinTypeInfo($record->buyer_pay_coin_type) ?></td>
                    <td align="right">买家下单日期：</td>
                    <td class="bold"><?= $record->buyer_order_time > 0 ? date('Y-m-d', $record->buyer_order_time) : '无' ?></td>
                    <td align="right">买家付款日期：</td>
                    <td class="bold"><?= $record->buyer_pay_time > 0 ? date('Y-m-d', $record->buyer_pay_time) : '无' ?></td>
                </tr>
                <tr>
                    <td align="right">买家下单号：</td>
                    <td class="bold"><?= $record->order_no ?></td>
                    <td align="right">留评时间：</td>
                    <td align="bold"><?= $record->review_time > 0 ? date('Y-m-d', $record->review_time) : '无' ?></td>
                    <td align="right">评论链接：</td>
                    <td class="bold"><?php if ($record->comment_link): ?><a href="<?= $record->comment_link ?>" target="_blank" class="btn blue">查看</a><?php else: ?>未填<?php endif; ?></td>
                    <td>测评类型：</td>
                    <td><?= $record->ceping_type == 0?'未标记':($record->ceping_type == 1?'销量':'测评'); ?></td>
                </tr>
                <tr>
                    <td align="right">收款账号：</td>
                    <?php if ($record->operator_id == $this->_user->id || in_array($this->_user->role_id,[7,8])): ?>
                        <td class="bold"><?= $obj->pay_account ?></td>
                    <?php else: ?>
                        <td class="bold">******</td>
                    <?php endif; ?>
                    <td align="right">联系方式：</td>
                    <?php if ($record->operator_id == $this->_user->id || in_array($this->_user->role_id,[7,8])): ?>
                        <td class="bold"><?= $obj->contact ?></td>
                    <?php else: ?>
                        <td class="bold">******</td>
                    <?php endif; ?>
                    <td align="right">付款金额：</td>
                    <td class="bold"><?= $obj->amount > 0 ? number_format($obj->amount, 3, '.', '') .'('.(IOSS_StaticConfig::getcoinTypeInfo($obj->coin_type) ? IOSS_StaticConfig::getcoinTypeInfo($obj->coin_type) : '').')' : '未填' ?></td>
                    <td align="right">对RMB汇率：</td>
                    <td class="bold"><?= $obj->rate_rmb > 0 ? $obj->rate_rmb : '未填' ?></td>
                </tr>
                <tr>
                    <td align="right">开户行：</td>
                    <td class="bold" colspan="7"><?= $obj->bank ?></td>
                </tr>

                <tr>
                    <td align="right">截图凭证：</td>
                    <td colspan="7" class="bold modal_image_list">
                        <?php if ($record->add_image): ?>
                            <?php if (strstr($record->add_image, 'doc') || strstr($record->add_image, 'xls')): ?>
                                <a href="<?= image_url('/' . $record->add_image) ?>">
                                    <img title="<?= $record->add_image ?>" src="/static/img/docx.png" width="auto" height="80"/>
                                </a>
                            <?php elseif (strstr($record->add_image, 'zip') || strstr($record->add_image, 'rar')): ?>
                                <a href="<?= image_url('/' . $record->add_image) ?>">
                                    <img title="<?= $record->add_image ?>" src="/static/img/zip.png" width="auto" height="80"/>
                                </a>
                            <?php else: ?>
                                <img class="img-rounded zoomify" src="<?= image_url($record->add_image) ?>" width="auto" height="80"/>
                            <?php endif; ?>
                        <?php else: ?>
                            <?= edit_form_uploader('add_image_' . $obj->id, set_uploader('add_image', $record->add_image), '') ?>
                        <?php endif; ?>
                        <?php if ($obj->add_image_1): ?>
                            <?php if (strstr($record->add_image_1, 'doc') || strstr($record->add_image_1, 'xls')): ?>
                                <a href="<?= image_url('/' . $record->add_image_1) ?>">
                                    <img title="<?= $obj->add_image_1 ?>" src="/static/img/docx.png" width="auto" height="80"/>
                                </a>
                            <?php elseif (strstr($record->add_image_1, 'zip') || strstr($record->add_image_1, 'rar')): ?>
                                <a href="<?= image_url('/' . $record->add_image_1) ?>">
                                    <img title="<?= $record->add_image_1 ?>" src="/static/img/zip.png" width="auto" height="80"/>
                                </a>
                            <?php else: ?>
                                <img class="img-rounded zoomify" src="<?= image_url($record->add_image_1) ?>" width="auto" height="80"/>
                            <?php endif; ?>
                        <?php else: ?>
                            <?= edit_form_uploader('add_image_1_' . $obj->id, set_uploader('add_image_1', $record->add_image_1), '') ?>
                        <?php endif; ?>
                        <?php if ($record->add_image_2): ?>
                            <?php if (strstr($record->add_image_2, 'doc') || strstr($record->add_image_2, 'xls')): ?>
                                <a href="<?= image_url('/' . $record->add_image_2) ?>">
                                    <img title="<?= $record->add_image_2 ?>" src="/static/img/docx.png" width="auto" height="80"/>
                                </a>
                            <?php elseif (strstr($record->add_image_2, 'zip') || strstr($record->add_image_2, 'rar')): ?>
                                <a href="<?= image_url('/' . $record->add_image_2) ?>">
                                    <img title="<?= $record->add_image_2 ?>" src="/static/img/zip.png" width="auto" height="80"/>
                                </a>
                            <?php else: ?>
                                <img class="img-rounded zoomify" src="<?= image_url($record->add_image_2) ?>" width="auto" height="80"/>
                            <?php endif; ?>
                        <?php else: ?>
                            <?= edit_form_uploader('add_image_2_' . $obj->id, set_uploader('add_image_2', $record->add_image_2), '') ?>
                        <?php endif; ?>
                    </td>
                </tr>
                <tr>
                    <td align="right">备注：</td>
                    <td colspan="7" class="bold" style="text-align: left">
                        <textarea style="width: 100%;" name="remark" cols="60" rows="4"><?= $obj->remark ?></textarea>
                    </td>
                </tr>
                <?php if (!in_array($this->_user->role_id, array(2, 4, 7))): ?>
                    <tr>
                        <td align="right">状态：</td>
                        <td class="bold" colspan="3">
                            <?= MTaskRecordItem::getState()[$obj->status]; ?>
                        </td>
                        <td align="right">创建时间：</td>
                        <td class="bold" colspan="4">
                            <?= date('Y-m-d H:i:s', $obj->create_time) ?>
                        </td>
                    </tr>
                <?php endif; ?>
            </table>
        </div>
    </div>
    <div style="clear:both;"></div>

    <?php if (in_array($this->_user->role_id, array(7,8))): ?>
        <?= edit_form_radio_list('status', array('2' => '不通过（如收款账号、金额有误）', '3' => '通过'), set_value('status', $obj->status ? $obj->status : '3'), '财务审核状态') ?>
        <div class="modal-footer">
            <button type="button" data-dismiss="modal" class="btn default">关闭</button>
            <button type="submit" class="btn btn-primary">提交审核状态</button>
        </div>
    <?php else:?>
        <div class="modal-footer">
            <span style="padding-right:20px;color:#e20000;">只有财务才可以审核更改状态</span>
            <button type="button" data-dismiss="modal" class="btn default">关闭</button>
        </div>
    <?php endif; ?>
</div>
<?= form_close() ?>
<script type="text/javascript">
    $(document).ready(function () {
        $('.img-rounded').zoomify();
        AjaxUploader.uploadTempUrl = "<?=site_url('/common/AjaxUpload/upload') . '/'  ?>";
        AjaxUploader.model_init('<?php echo $self?>');
    });
    function submitForm() {
        if (confirm('您确定要修改该任务操作记录的状态？')) {
            return true;
        } else {
            return false;
        }
    }
</script>

